<template>
    <div class="specialTask-registration-itself specialTask-w" :key="dealWithNumKey">
        <div class="dealwith-box-a-tabs">
            <div class="process-handling-card">
                <a-tabs type="card" v-if='formState.isTabs' v-model:activeKey="tabPaneActiveKey" @change="tabPaneChange">
                    <a-tab-pane key="申请信息" tab="申请信息"></a-tab-pane>
                    <!-- <a-tab-pane key="办理过程材料" tab="办理过程材料"></a-tab-pane> -->
                    <a-tab-pane key="环节流转记录" tab="环节流转记录"></a-tab-pane>
                </a-tabs>
            </div>
            <div  v-show="tabPaneActiveKey == '申请信息'" class="specialTask-application-info"
            :style="{height:formState.boxHeight?'calc(100vh - '+formState.boxHeight+'px)':(formState.modelHeight?'calc(100vh - 175px)':(!isReadOnly?'calc(100vh - 160px)':'calc(100vh - 152px)')),}"
             :class="[formState.isTabs?'handle-frame-color':(formState.modelHeight?'dealwith-application-modelHeight':''),formState.xzrw?'xzrw-box':'',formState.borderisFalse?'dealwith-application-borderisFalse':'isTabs-no-box']" >
                <div>
                    <a-collapse v-model:activeKey="submitActiveKey"  >
                        <a-collapse-panel key="1" header="审评基本信息" id="sqsxxxId">
                            <!-- <template #extra>
                                <span v-if="submitActiveKey.indexOf('1') !== -1" @click="submitActiveKey = submitActiveKey.filter(item => item !== '1')">折叠</span>
                                <span v-else @click="submitActiveKey.push('1')">展开</span>
                            </template>-->
                            <a-form
                                class="manufacturing-dealwith-itself"
                                ref="form"
                                layout="inline" 
                                :form="form" 
                                
                                >
                                <div v-if="isReadOnly">
                                    <a-form-item class="enter-btn" :wrapper-col="{ span: 12, offset: 6 }">
                                        <a-button style="margin-right:20px;" v-if="!isSelectEnterprise" class="blue-btn" type="primary"  @click="selectEnterprise(true)">选择企业</a-button>
                                        <a-button style="margin-right:20px;" v-else class="blue-btn" type="primary"  @click="addEnterprise(false)" >新增企业</a-button>
                                        <a-button class="blue-btn" type="primary" v-if="isSelectEnterprise" @click="renewEnterprise()" >更新企业</a-button>
                                    </a-form-item>
                                </div>
                                <a-form-item label="选择企业" v-show="isSelectEnterprise && isReadOnly" class="pull-input-w" required style="margin-right: 7px;">
                                    <commpPulldownTable
                                    :key="compEnterprisekey"
                                    :currentVlaue="enterValue"
                                    :selectTableConfig="enterSelectTableConfig" 
                                    :tableColumn="enterTableColumn" 
                                    @cellClickEvent="enterCellClickEvent"
                                    @changeEvent="enterChangeEvent" 
                                    
                                    />
                                    <span v-if="fqyidrequired" style="color: #f5222d;font-size: 14px;">请选择企业</span>
                                </a-form-item>
                                
                                <a-form-item label="企业名称" v-if="!isSelectEnterprise && isReadOnly">
                                    <a-input
                                    placeholder="请输入企业名称"
                                    v-model:value="formState.fqymc"
                                    v-decorator="['fqymc',{ initialValue:formState.fqymc, rules: rules.fqymc}]"/>
                                </a-form-item>
                                <a-form-item label="企业名称" v-if="!isReadOnly">
                                    <span>{{ formState.fqymc }}</span>
                                </a-form-item>
                                <a-form-item label="企业地址">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入企业地址"
                                        v-model:value="formState.fqyzszcdz"/>
                                        <span v-else>{{ formState.fqyzszcdz }}</span>
                                </a-form-item>
                                <a-form-item label="社会信用代码">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入社会信用代码"
                                        v-model:value="formState.ftyshxydm"
                                        v-decorator="['ftyshxydm',{ initialValue:formState.ftyshxydm, rules: rules.ftyshxydm}]"
                                        />
                                    <span v-else>{{ formState.ftyshxydm }}</span>
                                </a-form-item>
                                <a-form-item label="法人">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入法人"
                                        v-model:value="formState.fqyfddbrfzr"/>
                                    <span v-else>{{ formState.fqyfddbrfzr }}</span>
                                </a-form-item>
                                <a-form-item label="法人身份证">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入法人身份证"
                                        v-model:value="formState.ffzrsfzh"/>
                                    <span v-else>{{ formState.ffzrsfzh }}</span>
                                </a-form-item>
                                <a-form-item label="联系人">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入联系人"
                                        v-model:value="formState.fqylxr"/>
                                    <span v-else>{{ formState.fqylxr }}</span>
                                </a-form-item>
                                <a-form-item label="联系人电话">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入联系人电话"
                                        v-model:value="formState.fqylxrdh"/>
                                    <span v-else>{{ formState.fqylxrdh }}</span>
                                </a-form-item>
                                <a-form-item label="许可证编号">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入许可证编号"
                                        v-model:value="formState.fqyxkzh"/>
                                    <span v-else>{{ formState.fqyxkzh }}</span>
                                </a-form-item>
                                <a-form-item label="许可证有效期至">
                                    <a-date-picker  v-if="isReadOnly" v-model:value="formState.fqyxkzyxq" style="width: 100%;" />
                                    <span v-else>{{ formState.fqyxkzyxq }}</span>
                                </a-form-item>

                                <a-form-item label="审评行为名称（事项名称）" class="pull-input-w" required  style="margin-right: 7px !important;"> 
                                    <commpPulldownTable
                                    v-if="isReadOnly"
                                    :key="compSelectorkey"
                                    :currentVlaue="itemValue"
                                    :selectTableConfig="selectTableConfig" 
                                    :tableColumn="tableColumn" 
                                    @cellClickEvent="cellClickEvent"
                                    @changeEvent="changeEvent" 
                                    />
                                    <span v-else style="padding-top: 7px;display: inline-block;">{{ formState.fsxmc }}</span>
                                    <span v-if="fsxmcrequired" style="color: #f5222d;font-size: 14px;">请选择或输入事项名称</span>
                                </a-form-item>
                                <a-form-item label="审评日期" required>
                                    <a-range-picker
                                        :allowClear="false"
                                        format="YYYY-MM-DD"
                                        v-decorator="['inspectionDateArr',{ initialValue:formState.inspectionDateArr, rules: rules.inspectionDateArr}]"
                                    />
                                    <!-- @change="onChangeInspect"  -->
                                </a-form-item>
                                <a-form-item label="审评涉及品种类别（审评内容）">
                                    <a-select v-model:value="formState.fcyjcfw" placeholder="审评涉及品种类别（审评内容）" :options="varietyTypeList"></a-select>
                                </a-form-item>
                                <a-form-item label="任务来源">
                                    <a-select v-model:value="formState.frwly" placeholder="任务来源" :options="taskSourceList"></a-select>
                                </a-form-item>
                                <a-form-item label="有因线索审评补充信息">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="有因线索审评补充信息"
                                        v-model:value="formState.fyyxsjcbcxx"/>
                                    <span v-else>{{ formState.fyyxsjcbcxx }}</span>
                                </a-form-item>
                                <a-form-item label="审评涉及范围">
                                    <a-select v-model:value="formState.fjcsjfw" :options="scopeInspectionList"></a-select>
                                </a-form-item>
                                <a-form-item label="是否涉及暂停生产、销售的行政措施">
                                    <a-select v-model:value="formState.fsfsjztsc" placeholder="是否涉及暂停生产、销售的行政措施" :options="whetherList"></a-select>
                                </a-form-item>
                                <a-form-item label="暂停生产、销售行政措施公开信息的网页链接">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="暂停生产、销售行政措施公开信息的网页链接"
                                        v-model:value="formState.fztscwylj"/>
                                    <span v-else>{{ formState.fztscwylj }}</span>
                                </a-form-item>
                                <a-form-item label="是否涉及恢复生产、销售的行政措施">
                                    <a-select v-model:value="formState.fsfsjhfsc" placeholder="是否涉及恢复生产、销售的行政措施" :options="whetherList"></a-select>
                                </a-form-item>
                                <a-form-item label="恢复生产、销售行政措施公开信息的网页链接">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="恢复生产、销售行政措施公开信息的网页链接"
                                        v-model:value="formState.fhfscwylj"/>
                                    <span v-else>{{ formState.fhfscwylj }}</span>
                                </a-form-item>
                                <a-form-item label="此数据若涉及跨省审评，是否同意跨省落地">
                                    <a-select v-model:value="formState.fsftyksld" placeholder="此数据若涉及跨省审评，是否同意跨省落地" :options="whetherList"></a-select>
                                </a-form-item>
                                <a-form-item label="选择监管对象类型">
                                    <a-select v-model:value="formState.fxzjgdxlx" placeholder="选择监管对象类型" :options="regulatoryObjectList"></a-select>
                                </a-form-item>
                                <a-form-item label="是否涉及具体车间">
                                    <a-select v-model:value="formState.fsfsjjtcj" placeholder="是否涉及具体车间" :options="whetherList"></a-select>
                                </a-form-item>
                                <a-form-item label="是否涉及具体生产线">
                                    <a-select v-model:value="formState.fsfsjjtscx" placeholder="是否涉及具体生产线" :options="whetherList"></a-select>
                                </a-form-item>
                                <a-form-item label="剂型">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="剂型"
                                        v-model:value="formState.fjx"/>
                                    <span v-else>{{ formState.fjx }}</span>
                                </a-form-item>
                                <a-form-item label="规格">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入规格"
                                        v-model:value="formState.fgg"/>
                                    <span v-else>{{ formState.fgg }}</span>
                                </a-form-item>
                                <a-form-item label="登记号">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入登记号"
                                        v-model:value="formState.fdjh"/>
                                    <span v-else>{{ formState.fdjh }}</span>
                                </a-form-item>
                                <a-form-item label="生产地址">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入生产地址"
                                        v-model:value="formState.fxxdz"/>
                                    <span v-else>{{ formState.fxxdz }}</span>
                                </a-form-item>
                                <a-form-item label="车间">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入车间"
                                        v-model:value="formState.fcj"/>
                                    <span v-else>{{ formState.fcj }}</span>
                                </a-form-item>
                                <a-form-item label="生产线">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入生产线"
                                        v-model:value="formState.fscx"/>
                                    <span v-else>{{ formState.fscx }}</span>
                                </a-form-item>
                                <a-form-item label="监管事项">
                                    <a-input
                                        v-if="isReadOnly"
                                        placeholder="请输入监管事项"
                                        v-model:value="formState.fjgsx"/>
                                    <span v-else>{{ formState.fjgsx }}</span>
                                </a-form-item>
                                <a-form-item label="业务类型（审评类型）">
                                    <span>专项审评</span>
                                </a-form-item>
                                <a-form-item label="审评形式">
                                    <a-tree-select
                                        tree-default-expand-all
                                        v-model="formState.fjcxs"
                                        style="width: 100%"
                                        :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                                        :tree-data="inspectionformatTree"
                                        placeholder="审评形式"
                                        
                                    />
                                </a-form-item>
                                <a-form-item label="审评类别">
                                    <a-select v-model:value="formState.fjclb" placeholder="审评类别" :options="checkCategoryList"></a-select>
                                </a-form-item>
                                <a-form-item label="审评方式">
                                    <a-select v-model:value="formState.fjcfs" placeholder="审评方式" :options="checkCategoryList"></a-select>
                                </a-form-item>
                                
                                <a-form-item label="是否停产">
                                    <a-select v-model:value="formState.fsftc" placeholder="是否停产" :options="stopProductionList"></a-select>
                                </a-form-item>
                            </a-form>
                        </a-collapse-panel>
                        <a-collapse-panel key="2" header="相关材料">
                            <div v-if="!formState.sqsxid" style="color: #f5222d;font-size: 16px;font-weight: 600;" >（注：保存信息后才能查询相关需要上传材料目录）</div>
                            <div v-else style="display: flex;" class="related-materials-content-box" >
                                <div style="width: 30%; margin-right: 5px;height: calc(100vh - 286px);">
                                    <table border bordercolor="#d9d9d9" style="width: 100%; ">
                                        <tr v-for="(item,index) in relatedMaterialsArr" :key="index">
                                            <td>
                                                <div class="clmc-text-btn-v" >
                                                    <span class="text-title" >{{ item.clmc }}</span>
                                                    <a-upload style="display: inline-block;" :beforeUpload="$event=>{return false}" :showUploadList="false" action="" @change="singleUploadCahnge($event,item.clmc)">
                                                        <a-button
                                                        class="blue-btn" 
                                                        type="primary" icon="upload">上传</a-button>
                                                    </a-upload>
                                                </div>
                                                <div class="wjList-file-box" v-if="item.wjList && item.wjList.length">
                                                    <div  v-for="(trem,tIndex) in item.wjList" :key="tIndex">
                                                        <div class="wjList-item" @click="selectFileChange(trem)" :class="selectFileData.id == trem.id?'select-file-box':''">
                                                            {{ trem.fwjxsmc+trem.fwjlx }}
                                                            <a-icon type="download" class="toolbox-download-icon-type" style="display: inline-block;margin-right: 5px;font-size:16px;" @click.top.prevent="downloadFiles(trem)"/>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div v-else style="text-align: center;color: #999;margin: 10px 0" >
                                                    暂无数据！
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                                
                                <div style="flex: 1;" >
                                    <a-spin tip="正在加载中..." :spinning="zlmlSpinning">
                                        <iframe :src="zlmlIframeSrc" width="100%" :height="(windowInnerHeight - 292)+'px'"  v-if="zlmlIframeSrc"></iframe>
                                        <div v-else>
                                            <a-empty description="暂无文件或文件发生错误！"/>
                                        </div>
                                    </a-spin>
                                </div>
                            </div>
                        </a-collapse-panel>
                    </a-collapse>
                </div>
            </div>
            <div v-show="tabPaneActiveKey == '办理过程材料'" 
            class="specialTask-application-info" 
            :style="{height:formState.boxHeight?'calc(100vh - '+formState.boxHeight+'px)':(formState.modelHeight?'calc(100vh - 175px)':(!isReadOnly?'calc(100vh - 160px)':'calc(100vh - 152px)')),}"
            :class="[formState.modelHeight?'dealwith-application-modelHeight':'',formState.borderisFalse?'dealwith-application-borderisFalse':'']">>
                <div style="margin-bottom: 20px;">
                    <div v-if="centralMaterialObj.length" :key="centralMaterialKey">
                        <a-collapse v-model:activeKey="submitActiveKey">
                            <a-collapse-panel v-for="(item,index) in centralMaterialObj" :key="index+3+''" :header="item.mlmc" >
                                <table border="1" class="material-table" style="width: 100%;">
                                    <tr v-for="(term,tIndex) in item.mcList">
                                        <td style="width: 30%;">
                                            <span style="padding-left: 5px;">{{ term.clmc }}</span>
                                        </td>
                                        <td style="width: 60%;">
                                            <div style="display: flex;width: 100%;flex-wrap: wrap;">
                                                <div class="file-td-box" v-for="(section,sIndex) in term.wjList">
                                                    <a-icon class="delete-icon-v" type="delete" @click="deleteClick(section)" v-if="formState.currentLink && formState.currentLink == '数据修订'"/>
                                                    <a-icon class="eye-icon-v" type="eye" @click="lookOverClick(section)" v-if="section.fwjlx == '.pdf'"/>
                                                    <a-icon class="download-icon-v" type="download" @click="downloadClick(section)"/>
                                                    <a-icon class="file-icon-v" type="file-pdf" />
                                                    <span>{{ section.fwjxsmc+section.fwjlx }}</span>
                                                </div>
                                            </div>
                                        </td>
                                        <td style="width: 10%;" >
                                            <div style="width: 100%;display: flex;justify-content: center;align-items: center;margin: 5px 0;" v-if="formState.currentLink && formState.currentLink == '数据修订'">
                                                <a-upload v-if="isReadOnly" style="display: inline-block;" :beforeUpload="beforeUpload" action="" @change="leadingInClick($event,term)">
                                                    <a-button class="blue-btn" type="primary"  >上传</a-button>
                                                </a-upload>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </a-collapse-panel>
                        </a-collapse>
                    </div>
                    <div v-else style="width: 100%;text-align: center;font-size: 20px;margin: 20px 0;">暂无数据</div>
                </div>
            </div>
            <div v-show="tabPaneActiveKey == '环节流转记录'" 
            class="specialTask-application-info" 
            :style="{height:formState.boxHeight?'calc(100vh - '+formState.boxHeight+'px)':(formState.modelHeight?'calc(100vh - 175px)':(!isReadOnly?'calc(100vh - 160px)':'calc(100vh - 152px)')),}"
            :class="[formState.modelHeight?'dealwith-application-modelHeight':'',formState.borderisFalse?'dealwith-application-borderisFalse':'']">
                <div style="margin-bottom: 20px;">
                    <div style="padding:10px;background-color: #fff;margin-bottom: 10px;border: 1px solid #d9d9d9;">
                        <commpStep :parameterData="{index:formState.commpStepIndex,fhjmc:formState.fhjmc}"></commpStep>
                    </div>
                    
                    <a-collapse v-model:activeKey="submitActiveKey" >
                        <a-collapse-panel key="2" header="办理意见" class="collapse-panel-head-l255" >
                            <commpVxeTable
                                ref="headmanVxeTable"
                                :key="internalOpinionsKey"
                                :config="internalOpinionsConfig" 
                                :columns="internalOpinionsColumnsVxe" 
                                :formItem="[]"
                                :adaptiveHeight="true"
                            >
                            </commpVxeTable>
                        </a-collapse-panel>
                    </a-collapse>
                </div>
            </div>
        </div>
        <a-modal
        title="办理意见"
        v-model:visible="ideaVisible"
        @ok="ideaHandleOk"
        class="idea-modal-box"
        @cancel="ideaVisible = false"
        >
            <!-- <a-spin size="large" :spinning="spinning"> -->
                <a-form layout="inline">
                    <a-form-item label="办理意见" class="pull-input-w">
                        <div style="display: flex;align-items: center;">
                            <vxe-textarea rows="3" @focus="recordCommentsFocus" @blur="recordCommentsBlur" @change="recordCommentsChange"  v-model="opinionsText" placeholder="请输入或选择办理意见" suffix-icon="vxe-icon-search"></vxe-textarea>
                            <a-button style="margin-left: 15px;" class="blue-btn"  type="primary" @click.stop="saveComments" >保存</a-button>
                        </div>
                        <div class="opinion-record-box" v-show="isRecordComments">
                            <div v-if="opinionsList.length" class="content-box">
                                <div v-for="(item,index) in opinionsList" class="content-for">
                                    <div @click.stop="selectIdea(item)"  class="content-item">
                                        <span class="content-text">{{ item.fcontent }}</span>
                                        <a-button class="red-btn" size="small" type="primary" @click.stop="deleteIdea(item)" >删除</a-button>
                                    </div>
                                </div>
                            </div>
                            <div class="no-data-box" v-else>暂无记录！</div>
                        </div>
                    </a-form-item>
                </a-form>
            <!-- </a-spin> -->
        </a-modal>
        <serverEditingView ref="serverEditingViewRef" @refreshChange="$event=>{}"/>
    </div>
    
</template>
<script>
import serverEditingView from '@/components/comp-model-series/server-editing-view'
import commpPulldownTable from '@/components/commp-pulldown-table/commp-pulldown-table.vue'
import assessCheckApi from './service/api'
import {typeInput, typeNumber, typeSelect, typeCheckbox, typeRadio, } from '@/components/compSearchCriteria/ContractType'
import compSelector from '@/components/compSelector/compSelector'
import {
    autoSlbhBySqsxIdServe, 
    computeJzrqServe, 
    queryFirstNodeDbrServe, 
    spcyuploadQywjcl, 
    getLocalFileByIdServe,
    spcydownloadQysqclById,
    spcydeleteZxscQywjcl,
    spcycancelSelectWjclKck,
    deleteFileByIdServe,
    handlingOpinionsListServe,
    deleteBatchIdeaServe,
    addBatchIdeaServe,
    editenterdServe,
    addServe,
    spcyGetJobConcernByJobId,
    spcyaddSqsxBasic,
    spcyaddZxjcSqsx,
    editServe,
    getFileTypeServe,
    querySqsxWjmlFileList,
    xzxkApiDownloadZipFile,
    xzxkApiDownloadXzxkFjxx,
    spcyqueryKckWjclList,
    spcyqueryRcjgFjml,
    spcyuploadSqsxFile,
} from './service/index'
import validator from '@/common/validator'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import blobType from '@/common/blobType'
import moment, { now } from 'moment'
import YchConstant from "@/api/YchConstant";
import store from '@/store'

export default {
    name:'dealWith',
    components:{
        commpPulldownTable,
        compSelector,
        commpVxeTable,
        serverEditingView,
    },
    props:{
        parameter:{
            type:Object,
            default:() => {}
        }
    },
    
    data(){
        return{
            // parameter:{},
            tabPaneActiveKey:this.parameter.tabPaneActiveKey?this.parameter.tabPaneActiveKey:'申请信息',
            dealWithNumKey:null,
            centralMaterialObj:[],
            compEnterprisekey:null,
            spinning:true,
            blobType:blobType,
            routeName:this.$route.name,
            moment:moment,
            form: this.$form.createForm(this, { name: 'acceptanceDealWith' }),
            typeSelect:typeSelect,
            typeRadio:typeRadio,
            formState:{
                
            },
            //办理事项
            selectTableConfig:{
                api:assessCheckApi.fundamentals,
                rowName:'fsxmc',
                fywflcode:'001002'
            },
            tableColumn:[
                { field: 'fsxmc', title: '事项名称' },
                { field: 'fbjts', title: '办结天数' },
            ],
            //
            //企业
            enterSelectTableConfig:{
                api:assessCheckApi.queryPageList,
                rowName:'fqymc',
                fywflcode:'001002'
            },
            enterTableColumn:[
                { field: 'fqymc', title: '企业名称' },
                { field: 'fqyfddbrfzr', title: '企业法人' },
                { field: 'fqylxr', title: '联系人' },
                { field: 'fqylxrdh', title: '联系人电话' },
            ],
            //
            isSelectEnterprise:true,
            //产品
            productDisabled:true,
            productSelectTableConfig:{
                api:assessCheckApi.queryById,
                rowName:'fcpmc',
                fywflcode:'001002'
            },
            productTableColumn:[
                { field: 'fcpmc', title: '产品名称' },
            ],
            //
            HandledByOptions:[],//办理人
            itemValue:"",
            enterValue:"",
            productValue:"",
            rules:{
                fsxmc: [{
                    required: true,
                    message: '请选择事项名称',
                    trigger: 'blur',
                }],
                fsqsj: [{
                    type:'object',
                    required: true,
                    message: '请选择申请时间',
                    trigger: 'blur',
                }],
                inspectionDateArr: [{
                    type:'array',
                    required: true,
                    message: '请选择审评时间',
                    trigger: 'blur',
                }],
                // fslsj: [{
                //     type:'object',
                //     required: true,
                //     message: '请选择接收时间',
                //     trigger: 'blur',
                // }],
                // fslbh: [{
                //     required: true,
                //     message: '请输入任务编号',
                //     trigger: 'blur',
                // }],
                fqyid: [{
                    required: true,
                    message: '请选择企业',
                    trigger: 'blur',
                }],
                ftyshxydm: [{
                    required: true,
                    message: '请输入社会信用代码',
                    trigger: 'blur',
                }],
                fqymc: [{
                    required: true,
                    message: '请输入企业名称',
                    trigger: 'blur',
                }],
                dbrid: [{
                    type:'array',
                    required: this.parameter.dbridRequired?false:true,
                    message: '请选择办理人',
                    trigger: 'blur',
                }],
                opinion: [{
                    required: this.parameter.dbridRequired?false:true,
                    message: '请输入办理意见',
                    trigger: 'blur',
                }],
                
                
            },
            confirmLoading:false,
            submitActiveKey:['1','2','3','4','5','6','7','8','9','10'],
            dataTableConfig:{
                api:assessCheckApi.spcyqueryKckWjclList,
                rowId: 'id',
                fywflcode:'001002',
                height:400,
                autoHidden:true,
                pageSize:100,
                paramet:{
                    sqsxid:this.parameter.sqsxid
                }
            },
            submitConfig:{
                api:assessCheckApi.queryQySqclWjjlList,
                rowId: 'id',
                fywflcode:'001002',
                height:400,
                autoHidden:true,
                pageSize:100
            },
            requerstParame:{sqsxid:''},
            columnsVxe:[{
                title: '材料目录名称', //列头显示文字
                field: 'fwjlx1',
            },{
                title: '附件名称', //列头显示文字
                field: 'fwjxsmc',
            },{
                title: '操作',
                field: 'id',
                slots: {
                // 使用插槽模板渲染
                default: 'operation_btn',
                },
                // visible:!this.parameter.isReadOnly
            }],
            visishow:true,
            opinionsText:'',
            opinionsList:[],
            ideaVisible:false,
            fsxmcrequired:false,
            fqyidrequired:false,
            isArea:false,
            compSelectorkey:null,
            nextNode:'',
            isRecordComments:false,
            dbridRequired:false,
            isReadOnly:false,
            opinionsKey:null,
            blobTypeCode:'001002',
            internalOpinionsKey:null,
            internalOpinionsConfig:{
                api:assessCheckApi.querySqsxDetailsById,
                rowId: 'id',
                fywflcode:'001002',
                autoHidden:true,
                pageSize:10000,
                listData:'jobHistoryList',
                paramet:{
                    sqsxid:this.parameter.sqsxid
                }
            },
            internalOpinionsColumnsVxe:[{
                title: '环节名称', //列头显示文字
                field: 'fhjmc',
                width:112,
            },{
                title: '待办人', //列头显示文字
                field: 'fdbr',
            },{
                title: '办理人', //列头显示文字
                field: 'fblr',
            },{
                title: '发送时间', //列头显示文字
                field: 'ffssj',
            },{
                title: '办理时间', //列头显示文字
                field: 'fblsj',
            },{
                title: '使用工日',
                field: 'fsyts',
                width:80,
            },{
                title: '办理状态', //列头显示文字
                field: 'fblzt',
                width:80,
            },{
                title: '办理意见', //列头显示文字
                field: 'fblyj',
            }],
            qyFileList:[],
            iframeSrc:'',
            currentFileData:{},
            windowInnerHeight:window.innerHeight,
            varietyTypeList:[//审评涉及品种类别（审评内容）
                {value:'化学药品制剂',label:'化学药品制剂',},
                {value:'中成药',label:'中成药',},
                {value:'中药饮片',label:'中药饮片',},
                {value:'疫苗',label:'疫苗',},
                {value:'血液制品',label:'血液制品',},
                {value:'生物制品(疫苗、血液制品除外)',label:'生物制品(疫苗、血液制品除外)',},
                {value:'原料药',label:'原料药',},
                {value:'医用氧',label:'医用氧',},
                {value:'麻醉药品',label:'麻醉药品',},
                {value:'第一类精神药品',label:'第一类精神药品',},
                {value:'第二类精神药品',label:'第二类精神药品',},
                {value:'医疗用毒性药品',label:'医疗用毒性药品',},
                {value:'放射性药品',label:'放射性药品',},
                {value:'药品类易制毒化学品',label:'药品类易制毒化学品',},
                {value:'蛋白同化制剂',label:'蛋白同化制剂',},
                {value:'药用辅料',label:'药用辅料',},
                {value:'直接接触药品的包装材料',label:'直接接触药品的包装材料',},
                {value:'其他(具体说明)',label:'其他(具体说明)',},
            ],
            taskSourceList:[//任务来源
                {value:'其他类别审评',label:'其他类别审评',},
                {value:'有因审评',label:'有因审评',},
                {value:'疫苗GMP符合性审评',label:'疫苗GMP符合性审评',},
                {value:'血液制品GMP符合性审评',label:'血液制品GMP符合性审评',},
                {value:'生物制品GMP符合性审评',label:'生物制品GMP符合性审评',},
                {value:'中成药专项审评',label:'中成药专项审评',},
                {value:'中药饮片专项审评',label:'中药饮片专项审评',},
                {value:'特殊药品生产专项审评',label:'特殊药品生产专项审评',},
            ],
            scopeInspectionList:[//审评涉及范围
                {value:'大容量注射剂',label:'大容量注射剂',},
                {value:'小容量注射剂',label:'小容量注射剂',},
                {value:'粉针剂',label:'粉针剂',},
                {value:'冻干粉针剂片剂',label:'冻干粉针剂片剂',},
                {value:'硬胶囊剂',label:'硬胶囊剂',},
                {value:'软胶囊剂',label:'软胶囊剂',},
                {value:'颗粒剂',label:'颗粒剂',},
                {value:'散剂丸剂',label:'散剂丸剂',},
                {value:'口服混悬剂',label:'口服混悬剂',},
                {value:'合剂',label:'合剂',},
                {value:'口服溶液剂',label:'口服溶液剂',},
                {value:'口服乳剂',label:'口服乳剂',},
                {value:'糖浆剂',label:'糖浆剂',},
                {value:'酒剂',label:'酒剂',},
                {value:'茶剂',label:'茶剂',},
                {value:'露剂',label:'露剂',},
                {value:'搽剂',label:'搽剂',},
                {value:'洗剂',label:'洗剂',},
                {value:'栓剂',label:'栓剂',},
                {value:'涂剂',label:'涂剂',},
                {value:'软膏剂',label:'软膏剂',},
                {value:'乳膏剂',label:'乳膏剂',},
                {value:'眼用制剂',label:'眼用制剂',},
                {value:'耳用制剂',label:'耳用制剂',},
                {value:'鼻用制剂',label:'鼻用制剂',},
                {value:'凝胶剂',label:'凝胶剂',},
                {value:'贴剂',label:'贴剂',},
                {value:'贴膏剂',label:'贴膏剂',},
                {value:'膏药',label:'膏药',},
                {value:'锭剂',label:'锭剂',},
                {value:'流浸膏剂',label:'流浸膏剂',},
                {value:'浸膏剂',label:'浸膏剂',},
                {value:'煎膏剂',label:'煎膏剂',},
                {value:'胶剂',label:'胶剂',},
                {value:'膜剂',label:'膜剂',},
                {value:'涂膜剂',label:'涂膜剂',},
                {value:'糊剂',label:'糊剂',},
                {value:'植入剂',label:'植入剂',},
                {value:'冲洗剂',label:'冲洗剂',},
                {value:'灌肠剂',label:'灌肠剂',},
                {value:'气雾剂',label:'气雾剂',},
                {value:'吸入制剂',label:'吸入制剂',},
                {value:'喷雾剂',label:'喷雾剂',},
                {value:'进口药品分包装',label:'进口药品分包装',},
                {value:'胶丸',label:'胶丸',},
                {value:'蜜丸',label:'蜜丸',},
                {value:'水蜜丸',label:'水蜜丸',},
                {value:'水丸',label:'水丸',},
                {value:'浓缩丸',label:'浓缩丸',},
                {value:'糖丸',label:'糖丸',},
                {value:'蜡丸',label:'蜡丸',},
                {value:'滴丸',label:'滴丸',},
                {value:'滴眼剂',label:'滴眼剂',},
                {value:'洗眼剂',label:'洗眼剂',},
                {value:'眼内注射溶液',label:'眼内注射溶液',},
                {value:'眼膏剂',label:'眼膏剂',},
                {value:'眼用乳膏剂',label:'眼用乳膏剂',},
                {value:'眼用凝胶剂',label:'眼用凝胶剂',},
                {value:'眼膜剂',label:'眼膜剂',},
                {value:'眼丸剂',label:'眼丸剂',},
                {value:'眼内插入剂',label:'眼内插入剂',},
                {value:'膏滋',label:'膏滋',},
                {value:'原料药',label:'原料药',},
                {value:'无菌原料药',label:'无菌原料药',},
                {value:'预防用生物制品',label:'预防用生物制品',},
                {value:'治疗用生物制品',label:'治疗用生物制品',},
                {value:'血液制品',label:'血液制品',},
                {value:'体内诊断试剂',label:'体内诊断试剂',},
                {value:'体外诊断试剂',label:'体外诊断试剂',},
                {value:'医疗用毒性药品',label:'医疗用毒性药品',},
                {value:'麻醉药品',label:'麻醉药品',},
                {value:'精神药品',label:'精神药品',},
                {value:'药品类易制毒化学品',label:'药品类易制毒化学品',},
                {value:'药用辅料',label:'药用辅料',},
                {value:'中药饮片(含毒性饮片)',label:'中药饮片(含毒性饮片)',},
                {value:'中药饮片(直接口服饮片)',label:'中药饮片(直接口服饮片)',},
                {value:'中药饮片',label:'中药饮片',},
                {value:'医用气体',label:'医用气体',},
                {value:'空心胶囊',label:'空心胶囊',},
                {value:'有因线索审评',label:'有因线索审评',},
            ],
            whetherList:[
                {value:'是',label:'是',},
                {value:'否',label:'否',},
            ],
            regulatoryObjectList:[//选择监管对象类型
                {value:'药品生产企业',label:'药品生产企业',},
                {value:'产品(药品制剂)',label:'产品(药品制剂)',},
                {value:'产品(延伸审评)',label:'产品(延伸审评)',},
                {value:'产品(中药饮片)',label:'产品(中药饮片)',},
                {value:'产品(其他产品)',label:'产品(其他产品)',},
                {value:'场地场所',label:'场地场所',},
                {value:'其他',label:'其他',},
            ],
            inspectionformatTree:[{//审评形式
                title: '日常审评',
                value: '日常审评',
                key: '日常审评',
                children: [{
                    title:'常规审评',
                    value:'常规审评',
                    key:'常规审评',
                }],
            },{
                title: '专项审评',
                value: '专项审评',
                key: '专项审评',
                children: [{
                    title:'专项审评',
                    value:'专项审评',
                    key:'专项审评',
                }],
            },{
                title: '其他',
                value: '其他',
                key: '其他',
                children: [{
                    title:'许可审评',
                    value:'许可审评',
                    key:'许可审评',
                },{
                    title:'有因审评',
                    value:'有因审评',
                    key:'有因审评',
                },{
                    title:'其他审评',
                    value:'其他审评',
                    key:'其他审评',
                }],
            }],
            checkCategoryList:[//审评类别--审评方式
                {value:'技术审评',label:'技术审评',},
                {value:'非技术审评',label:'非技术审评',},
            ],
            stopProductionList:[//是否停产
                {value:'正常',label:'正常',},
                {value:'自动停产',label:'自动停产',},
                {value:'责令停产',label:'责令停产',},
            ],
            relatedMaterialsArr:[],
            zlmlSpinning:false,
            zlmlIframeSrc:'',
            selectFileData:{},
        }
    },
    
    created(){
        this.getHandledBy()
        this.getHandlingOpinionsList('')
    },
    updated(){
        
    },
    watch:{
        parameter: {
            handler(newval, oldVal){
                //console.log('获取数据dealWith',newval)
                if(newval.sqsxid){
                    this.getFileChange(newval)
                }
                this.isSelectEnterprise = newval.fqyid?true:false
                this.dbridRequired = newval.dbridRequired?true:false
                this.isReadOnly = !newval.isReadOnly
                newval.fsqsj = newval.fsqsj?newval.fsqsj:''
                newval.fbldwmc = newval.fbldwmc?newval.fbldwmc:'xx食品药品审评查验中心'
                // newval.fslsj = newval.fslsj?newval.fslsj:moment().format('YYYY-MM-DD HH:mm:ss')
                newval.inspectionDateArr = newval.fcykssj && newval.fcyjssj? [moment(newval.fcykssj).format('YYYY-MM-DD'),moment(newval.fcyjssj).format('YYYY-MM-DD')]:[]
                this.formState = JSON.parse(JSON.stringify(newval))
                this.itemValue = newval.fsxmc
                this.enterValue = newval.fqymc
                this.productValue = newval.fcpmc
                this.requerstParame.sqsxid = newval.sqsxid
                // this.$forceUpdate()
                this.compEnterprisekey = Date.now()
                // this.compSelectorkey = Date.now()
                this.compSelectorkey = Date.now()
                
            },
            immediate: true,
            deep:true

        },
    },
    methods:{
        
        getDatas(val){
            this.$emit('updatedSuccess')
            this.parameter = val
            this.internalOpinionsConfig.paramet = {sqsxid:val.sqsxid}
            this.dataTableConfig.paramet = {sqsxid:val.sqsxid}
            this.iframeSrc = ''
        },
        getFileChange(val){//相关材料
            spcyqueryRcjgFjml({sqsxid:val.sqsxid}).then(res=>{
                if(res.code == 200){
                    //console.log('我获取了相关材料',res)
                    this.relatedMaterialsArr = res.result
                    let num = 0
                    this.relatedMaterialsArr.forEach((item,index)=>{
                        if(item.wjList.length && !num){
                            num = 1
                            this.selectFileChange(item.wjList[0])
                        }
                    })
                }else{
                    this.relatedMaterialsArr = []
                }
            })
        },
        selectFileChange(trem){
            this.selectFileData = trem
            this.zlmlSpinning = true
            if(trem.fwjlx == '.doc' || trem.fwjlx == '.docx'){
                openFileReadOnly({id:trem.id}).then(res=>{
                    if(res.code == 200){
                        //console.log('我一直在请求吗？',res.result.wordUrl)
                        this.zlmlIframeSrc = res.result.wordUrl
                    }else{
                        this.zlmlIframeSrc = ''
                    }
                    this.zlmlSpinning = false
                })
            }else{
                this.zlmlIframeSrc = bootConfig[process.env.NODE_ENV].locality_ApI + YchConstant.SPZX_SPCY + '/spcyRsWjmb/openWjjl?id='+trem.id
                this.zlmlSpinning = false
            }
        },
        //上传
        singleUploadCahnge({file},val){
                var that = this
                const fileData = new FormData();
                fileData.append("file",file);
                fileData.append("sqsxid",this.formState.sqsxid);
                fileData.append("type",val);
                spcyuploadSqsxFile(fileData).then(res => {
                    if(res.code !== 200){
                        that.$message.warning('请上传pdf文件或者联系管理员!')
                    }else{
                        that.getFileChange(this.formState)
                        that.$message.success('上传成功')
                    }
                    
                })
            
        },
        downloadFiles(val){//下载
            var that = this
            
            var fileName = val.fwjxsmc?val.fwjxsmc:val.fwjccmc
            let param = { fywflcode:'001002',id:val.id,sqsxid:this.currentRow.sqsxid}
            spcySqsxWjjlgetLocalFileById(param).then((data) => {
                if (!data) {
                    that.$message.warning('文件下载失败')
                return
                }
                    let url = window.URL.createObjectURL(new Blob([data], { type: blobType.type[blobType.suffix.indexOf(val.fwjlx)] }))
                    let link = document.createElement('a')
                    link.style.display = 'none'
                    link.href = url
                    link.setAttribute('download', fileName + val.fwjlx)
                    document.body.appendChild(link)
                    link.click()
                    document.body.removeChild(link) //下载完成移除元素
                    window.URL.revokeObjectURL(url) //释放掉blob对象
            })
        },
        tabPaneChange(val){
            //console.log('有没有触发到这里---------',val)
            this.tabPaneActiveKey = val
               
        },
        fsqsjChange(val){
            //console.log(val)
            this.formState.fsqsj = moment(val).format('YYYY-MM-DD')
        },
        getHandlingOpinionsList(val){//查询办理意见
            handlingOpinionsListServe({ftype1:'办理意见',pageNo:1,pageSize:1000,fcontent:val}).then(res=>{
                if(res.code == 200){
                    this.opinionsList = res.result.records
                }
            })
        },
        recordCommentsChange(){
            this.getHandlingOpinionsList(this.opinionsText)
        },
        selectIdea(val){//选择办理意见
            this.opinionsText = val.fcontent
            this.isRecordComments = false
            this.recordCommentsBlur()
        },
        recordCommentsFocus(){
            this.isRecordComments = true
        },
        recordCommentsBlur(){},
        deleteIdea(val){//删除办理意见
            deleteBatchIdeaServe({ids:val.id}).then(res=>{
                if(res.code == 200){
                    this.getHandlingOpinionsList(this.opinionsText)
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        ideaHandleOk(){
            var that = this
            this.ideaVisible = false
            
            //console.log('this.opinionsText',this.opinionsText)
            this.formState.opinion = this.opinionsText
            
            this.opinionsKey = Date.now()
            //console.log('this.opinionsText',this.formState.opinion)
           this.form.setFieldsValue({
                opinion:that.opinionsText,
            });

           
        },
        saveComments(){
            this.ideaHandleOk()
            if(this.opinionsText){
                addBatchIdeaServe({ftype1:'办理意见',fcontent:this.opinionsText}).then(res=>{
                    if(res.code == 200){
                        this.$message.success(res.message)
                    }else{
                        this.$message.warning(res.message)
                    }
                    this.getHandlingOpinionsList()
                })
            }
        },
        beforeUpload(e){
            return false
        },
        leadingInClick({file}){//上传
            var that = this
            if(typeof file.uid !== 'undefined') {
                    const fileData = new FormData();
                    fileData.append("file",file);
                    fileData.append("fywflcode",this.blobTypeCode);
                    fileData.append("sqsxid",this.formState.sqsxid);
                    fileData.append("fwjlx1",'企业申报材料');
                    spcyuploadQywjcl(fileData).then(res => {
                        //console.log(res)
                        if(res.code){
                            that.$message.warning('请上传pdf文件或者联系管理员!')
                        }else{
                            that.$message.success('上传成功')
                            this.getFileData()
                        }
                    })
                
            }
        },
        leadingInWidSc(){
            this.$message.warning('请先填写相关数据')
            this.handlePreserve(1)
            const el = document.getElementById('sqsxxxId');
            if (el) {
                el.scrollIntoView({ behavior: 'smooth' });
            }
        },
        viewClick(val){
            this.$refs.serverEditingViewRef.getData({id:val.id,fwjlx:val.fwjlx})
            this.$refs.serverEditingViewRef.serverEditingVisible = true
        },
        //查看
        lookOverClick(val){
            //console.log('查看',val)
            getFileTypeServe({id:val.id}).then(res=>{
                if(res.code == 200){
                    if(res.result == '.pdf'){
                        window.open(
                            bootConfig[process.env.NODE_ENV].locality_ApI+YchConstant.SPZX_SPCY+'/spcySqsxWjjl/getCrossLocalFile?id='+val.id
                        )
                    }else{
                        this.$message.warning('只能查看pdf文件')
                    }
                    
                }
                
            })
            
        },
        downloadClick(val){
            //console.log(val)
            var that = this
            this.DownloadTemplateLoading = true
            var fileName = val.fclmc
            let param = { fywflcode:'001002',id:val.id}
            // getLocalFileByIdServe
            spcydownloadQysqclById(param).then((data) => {
                this.DownloadTemplateLoading = false
                if (!data) {
                    that.$message.warning('文件下载失败')
                    return
                }
                    let index = blobType.suffix.indexOf(val.fwjlx)
                    let url = window.URL.createObjectURL(new Blob([data], { type:blobType.type['.pdf'] }))
                    let link = document.createElement('a')
                    link.style.display = 'none'
                    link.href = url
                    link.setAttribute('download', fileName )
                    document.body.appendChild(link)
                    link.click()
                    document.body.removeChild(link) //下载完成移除元素
                    window.URL.revokeObjectURL(url) //释放掉blob对象
                // }
            })
        },
        qytjclDeleteClick(val){
            var that = this
            this.$confirm({
                title:'您确认要删除吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    spcydeleteZxscQywjcl({id:val.id}).then(res=>{
                        if(res.code == 200){
                            that.$message.success('删除成功')
                            that.getFileData()
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                    // deleteFileByIdServe({id:val.id}).then(res=>{
                    //     if(res.code == 200){
                    //         that.$message.success('删除成功')
                    //         that.getFileData()
                    //     }else{
                    //         that.$message.warning(res.message)
                    //     }
                    // })
                },
                
            });
        },
        deleteClick(val){//删除附件
            var that = this
            this.$confirm({
                title:'您确认要删除吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    spcycancelSelectWjclKck({id:val.id}).then(res=>{
                        if(res.code == 200){
                            that.$message.success('删除成功')
                            that.getFileData()
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                    // deleteFileByIdServe({id:val.id}).then(res=>{
                    //     if(res.code == 200){
                    //         that.$message.success('删除成功')
                    //         that.getFileData()
                    //     }else{
                    //         that.$message.warning(res.message)
                    //     }
                    // })
                },
                
            });
            
        },
        async getHandledBy(){//获取办理人
            queryFirstNodeDbrServe().then(res=>{
                //console.log('办理人',res)
                if(res.code == 200){
                    this.nextNode = res.result?res.result.nextNode:''
                    if(res.result && res.result.nextNodeDbrList){
                        res.result.nextNodeDbrList.forEach(item => {
                            item = {
                                value:item.dbrid,
                                label:item.dbr
                            }
                            this.HandledByOptions.push(item)
                        });
                    }
                }
            })
        },
        cellClickEvent(val){//获取办理事项行
            //console.log(val)
            this.formState.fsxmc = val.fsxmc
            this.formState.fwcsx = val.fbjts
            this.deadline(this.formState.fwcsx,this.formState.fslsj)
            this.fsxmcrequired = false
        },
        deadline(val1,val2){//截止时间
            //console.log(val1,val2)
            if(val1&&val2){
                computeJzrqServe({fwcsx:val1,fslsj:val2}).then(res=>{
                    //console.log('截止日期',res)
                    if(res.code == 200){
                        this.formState.fjzrq = res.result.fjzrq
                    }
                })
            }
        },
        changeEvent(val){
            //console.log(val)
            this.formState.fsxmc = val
            if(this.formState.fsxmc){
                this.fsxmcrequired = false
                this.$forceUpdate()
            }else{
                this.fsxmcrequired = true
                this.$forceUpdate()
            }
            
            
        },
        fslsjChange(val){
            //console.log(moment(val).format('YYYY-MM-DD'))
            this.deadline(this.formState.fwcsx,moment(val).format('YYYY-MM-DD'))
            this.formState.fslsj = moment(val).format('YYYY-MM-DD HH:mm:ss')
        },
        fwcsxChange(val){
            
            this.deadline(this.formState.fwcsx,this.formState.fslsj)
            //console.log(val)
        },
        enterCellClickEvent(val){//获取企业
            //console.log('获取企业',val)
            this.fqyidrequired = false
            this.compEnterprisekey = Date.now()
            this.formState.fqyid = val.id
            this.formState.fqymc = val.fqymc
            this.enterValue = val.fqymc
            this.formState.ftyshxydm = val.ftyshxydm
            this.formState.fqyfddbrfzr = val.fqyfddbrfzr
            this.formState.fqylxr = val.fqylxr
            this.formState.fqylxrdh = val.fqylxrdh
            this.formState.fqyzszcdz = val.fqyzszcdz
            this.formState.ffzrsfzh = val.ffzrsfzh
            this.formState.ffzrlxfs = val.ffzrlxfs
            this.formState.fscdz = val.fscdz
            this.formState.fscfw = val.fscfw
            this.formState.fqyxkzh = val.fqyxkzh
            this.formState.fqyxkzyxq = val.fqyxkzyxq?moment(val.fqyxkzyxq):''
            this.formState.fsxjclx = val.fsxjclx
            this.formState.fscxcj = val.fscxcj
            this.formState.fjcpz = val.fjcpz
            this.formState.fszdq = val.fszdq
            this.formState.fxxdz = val.fxxdz
            
        },
        numbering(){//取号
            if(!this.formState.fjclx){
                this.$message.warning('请先选择业务类型')
            }else{
                autoSlbhBySqsxIdServe({fjclx:this.formState.fjclx}).then(res=>{
                    if(res.code == 200){
                        this.formState.fslbh = res.result.fslbh
                        this.form.setFieldsValue({
                            fslbh:res.result.fslbh,
                        });
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }
        },
        enterChangeEvent(val){

        },
        selectEnterprise(val){//选择企业
            this.isSelectEnterprise = val
            this.fqyidrequired = true
            this.isArea = true
            this.$forceUpdate()
            this.compEnterprisekey = Date.now()
        },
        addEnterprise(val){//新增企业
            this.isSelectEnterprise = val
            this.enterValue = ''
            this.formState.fqyid = ''
            this.formState.fqymc = ''
            this.formState.ftyshxydm = ''
            this.formState.fqyfddbrfzr = ''
            this.formState.fqylxr = ''
            this.formState.fqylxrdh = ''
            this.formState.fqyzszcdz = ''
            this.formState.fszdq = '南宁'
            this.formState.fxxdz = ''
            this.formState.ffzrsfzh = ''
            this.formState.ffzrlxfs = ''
            this.formState.fscdz = ''
            this.formState.fscfw = ''
            this.formState.fqyxkzh = ''
            this.formState.fqyxkzyxq = ''
            this.formState.fsxjclx = ''
            this.formState.fscxcj = ''
            this.formState.fjcpz = ''
            this.fqyidrequired = false
            this.compEnterprisekey = Date.now()
            this.$forceUpdate()
        },
        renewEnterprise(){//更新企业
            if(this.formState.fqyid){
                let data={
                    id:this.formState.fqyid,
                    fqymc:this.formState.fqymc,
                    ftyshxydm:this.formState.ftyshxydm,
                    fqyfddbrfzr:this.formState.fqyfddbrfzr,
                    fqylxr:this.formState.fqylxr,
                    fqylxrdh:this.formState.fqylxrdh,
                    fqyzszcdz:this.formState.fqyzszcdz,
                    fszdq:this.formState.fszdq,
                    fxxdz:this.formState.fxxdz,
                    ffzrsfzh:this.formState.ffzrsfzh,
                    ffzrlxfs:this.formState.ffzrlxfs,
                    fscdz:this.formState.fscdz,
                    fscfw:this.formState.fscfw,
                    fqyxkzh:this.formState.fqyxkzh,
                    fqyxkzyxq:this.formState.fqyxkzyxq?moment(this.formState.fqyxkzyxq).format('YYYY-MM-DD'):'',
                    fsxjclx:this.formState.fsxjclx,
                    fscxcj:this.formState.fscxcj,
                    fjcpz:this.formState.fjcpz,
                }
                editenterdServe(data).then(res=>{
                    if(res.code == 200){
                        this.$message.success('更新成功')
                    }else{
                        this.$message.warning('更新失败')
                    }
                })
            }else{
                this.fqyidrequired = true
            }
            
        },
        productCellClickEvent(){//获取选中产品项

        },
        productChangeEvent(val){//获取产品当前输入框的值
            this.formState.fcpmc = val
        },
        popupScroll(){

        },
        ideakeyupEvent(){
            
        },
        ideaClick(){
            this.ideaVisible = true
            this.spinning = true
            this.formState.opinion = this.opinionsText
        },
        ideaBlur(){

        },
        ideaFocusEvent(){
            //console.log('2222')
            this.ideaBlur()
        },
        handlePreserve(val){//保存
            if(!this.formState.fsxmc){
                this.fsxmcrequired = true
            }
            // if(!this.formState.fqyid){
            //     this.fqyidrequired = true
            // }
            //console.log(this.fsxmcrequired)
            this.form.validateFields((err, values) => {
                // //console.log(err)
                if(!err){
                    //console.log(this.formState.fsxmc)
                    if(!this.formState.fsxmc){
                        this.fsxmcrequired = true
                        return
                    }
                    var data = {
                        map:{
                            fsxmc:this.formState.fsxmc,
                            fslzt:this.formState.fslzt,
                            fslsj:this.formState.fslsj?moment(this.formState.fslsj).format('YYYY-MM-DD HH:mm:ss'):'',
                            fslbh:values.fslbh,
                            fwcsx:this.formState.fwcsx,
                            fcyjcfw:this.formState.fcyjcfw,
                            fjcdd:this.formState.fjcdd,
                            fqyid:this.formState.fqyid,
                            fqymc:this.formState.fqymc,
                            ftyshxydm:values.ftyshxydm,
                            fqyfddbrfzr:this.formState.fqyfddbrfzr,
                            fqylxr:this.formState.fqylxr,
                            fqylxrdh:this.formState.fqylxrdh,
                            fqyzszcdz:this.formState.fqyzszcdz,
                            fszdq:this.formState.fszdq,//
                            fxxdz:this.formState.fxxdz,
                            ffzrsfzh:this.formState.ffzrsfzh,
                            ffzrlxfs:this.formState.ffzrlxfs,
                            fscdz:this.formState.fscdz,
                            fscfw:this.formState.fscfw,
                            fqyxkzh:this.formState.fqyxkzh,
                            fqyxkzyxq:this.formState.fqyxkzyxq?moment(this.formState.fqyxkzyxq).format('YYYY-MM-DD'):'',
                            fsxjclx:this.formState.fsxjclx,
                            fscxcj:this.formState.fscxcj,
                            fjcpz:this.formState.fjcpz,

                            
                            fcykssj:moment(this.formState.inspectionDateArr[0]).format('YYYY-MM-DD'),
                            fcyjssj:moment(this.formState.inspectionDateArr[1]).format('YYYY-MM-DD'),
                            frwly:this.formState.frwly,
                            fyyxsjcbcxx:this.formState.fyyxsjcbcxx,
                            fjcsjfw:this.formState.fjcsjfw,
                            fsfsjztsc:this.formState.fsfsjztsc,
                            fztscwylj:this.formState.fztscwylj,
                            fsfsjhfsc:this.formState.fsfsjhfsc,
                            fhfscwylj:this.formState.fhfscwylj,
                            fsftyksld:this.formState.fsftyksld,
                            fxzjgdxlx:this.formState.fxzjgdxlx,
                            fsfsjjtcj:this.formState.fsfsjjtcj,
                            fsfsjjtscx:this.formState.fsfsjjtscx,
                            fjx:this.formState.fjx,
                            fgg:this.formState.fgg,
                            fdjh:this.formState.fdjh,
                            fxxdz:this.formState.fxxdz,
                            fcj:this.formState.fcj,
                            fscx:this.formState.fscx,
                            fjgsx:this.formState.fjgsx,
                            fjcxs:this.formState.fjcxs,
                            fjclb:this.formState.fjclb,
                            fjcfs:this.formState.fjcfs,
                            fsftc:this.formState.fsftc,
                            
                            
                        }
                    }
                    if(!this.formState.sqsxid && val){
                        spcyaddZxjcSqsx({fywflcode:'001002'}).then(res1=>{
                            //console.log(res1)
                            if(res1.code == 200){
                                this.formState.sqsxid = res1.result.sqsx.id
                                this.formState.jobid = res1.result.job.id
                                data = {
                                    jobid:this.formState.jobid,
                                    sqsxid:this.formState.sqsxid,
                                    opinion:this.formState.opinion,
                                    smgflag:this.formState.smgflag?'是':'否',
                                    ...data,
                                    
                                }
                                
                                addServe(data).then(res2=>{
                                    if(res2.code == 200){
                                        spcyGetJobConcernByJobId({jobid:data.jobid}).then(resxx=>{
                                            if(resxx.code == 200){
                                                let data = resxx.result
                                                let sqsx = resxx.result.sqsx
                                                this.formState = this.parameter = {
                                                    ...this.formState,
                                                    fywflcode:'001002',
                                                    ...data,
                                                    jobid:data.job.id,
                                                    fblzt:data.job.fblzt,
                                                    fthyj:data.job.fthyj,
                                                    ...sqsx,
                                                    sqsxid:sqsx.id,
                                                    fslzt:String(sqsx.fslzt),
                                                    fsqsj:sqsx.fsqsj?moment(sqsx.fsqsj).format('YYYY-MM-DD'):'',
                                                    fslsj:sqsx.fslsj?moment(sqsx.fslsj).format('YYYY-MM-DD'):'',
                                                    isOwn:true,
                                                    dbrid:[],
                                                    opinion:'',//办理意见
                                                    smgflag:false,//是否发送短信
                                                    ...data.qy,
                                                    fqymc:sqsx.fqymc,
                                                }
                                                // this.$message.success(res2.message)
                                                this.confirmLoading = false
                                                //console.log('我得到什么类型1',val)
                                                this.$emit('successReturn',true,this.formState)
                                                this.$emit('linkHandlingReturn',{val:true,row:this.formState,type:val})
                                                
                                            }else{
                                                this.$message.warning(resxx.message)
                                                this.confirmLoading = false
                                            }
                                        })
                                        // this.$store.dispatch('UpdateSpinningPrice', {key:true,stateKey:'modalSpinningPrice'}).then(() => {
                                            
                                        // })
                                        this.$message.success(res2.message)
                                    }else{
                                        // this.$store.dispatch('UpdateSpinningPrice', {key:false,stateKey:'modalSpinningPrice'})
                                        this.$message.warning(res2.message)
                                        this.confirmLoading = false
                                    }
                                })
                                this.getFileChange(this.formState)
                            }else{
                                this.$message.warning(res1.message)
                            }
                        })
                    }else{
                        data = {
                            jobid:this.formState.jobid,
                            sqsxid:this.formState.sqsxid,
                            // dbrid:values.dbrid.join(','),
                            opinion:this.formState.opinion,
                            smgflag:this.formState.smgflag?'是':'否',
                            ...data,
                        }
                        addServe(data).then(res=>{
                            if(res.code == 200){
                                // this.$store.dispatch('UpdateSpinningPrice', {key:true,stateKey:'modalSpinningPrice'}).then(() => {
                                    if(val){
                                        this.$message.success(res.message)
                                    }
                                    
                                    this.confirmLoading = false
                                    this.visishow = false
                                    //console.log('我得到什么类型',val)
                                    this.$emit('successReturn',true,undefined)
                                    this.$emit('linkHandlingReturn',{val:true,row:undefined,type:val})
                                // })
                                
                            }else{
                                // this.$store.dispatch('UpdateSpinningPrice', {key:false,stateKey:'modalSpinningPrice'})
                                this.$message.warning(res.message)
                                this.confirmLoading = false
                            }
                        })
                    }
                }
            });
        },
        shandleSubmit(row){//提交
            let canHandle = false
            if(!this.formState.fsxmc){
                this.fsxmcrequired = true
            }
            // if(!this.formState.fqyid){
            //     this.fqyidrequired = true
            // }
            this.form.validateFields((err, values) => {
                if(!err){
                    if(!this.formState.fsxmc){
                        this.fsxmcrequired = true
                        return
                    }
                    // if(!this.formState.fqyid){
                    //     this.fqyidrequired = true
                    //     return
                    // }
                    // if(!this.formState.fsxmc || (!this.formState.fqyid && this.isSelectEnterprise)){
                    //     if(!this.formState.fsxmc){
                    //         this.fsxmcrequired = true
                    //     }else{
                    //         this.fsxmcrequired = false
                    //     }
                    //         if(!this.formState.fqyid && this.isSelectEnterprise){
                    //             this.fqyidrequired = true
                    //         }else{
                    //             this.fqyidrequired = false
                    //         }
                            
                    //         return
                    // }
                    // let data = {
                    //     jobid:this.formState.jobid,
                    //     sqsxid:this.formState.sqsxid,
                    //     dbrid:values.dbrid.join(','),
                    //     opinion:values.opinion,
                    //     smgflag:this.formState.smgflag?'是':'否',
                    //     map:{
                    //         fsxmc:this.formState.fsxmc,
                    //         fsqsj:moment(values.fsqsj).format('YYYY-MM-DD HH:mm:ss'),
                    //         fjclx:this.formState.fjclx,
                    //         fslzt:this.formState.fslzt,
                    //         fslsj:moment(values.fslsj).format('YYYY-MM-DD HH:mm:ss'),
                    //         fslbh:this.formState.fslbh,
                    //         fwcsx:this.formState.fwcsx,
                                //fcyjcfw:this.formState.fcyjcfw,
                                //fjcdd:this.formState.fjcdd,
                    //         fjzrq:this.formState.fjzrq,
                    //         fqyid:this.formState.fqyid,
                    //         fqymc:this.formState.fqymc,
                    //         ftyshxydm:values.ftyshxydm,
                    //         fqyfddbrfzr:this.formState.fqyfddbrfzr,
                    //         fqylxr:this.formState.fqylxr,
                    //         fqylxrdh:this.formState.fqylxrdh,
                    //         fqyzszcdz:this.formState.fqyzszcdz,
                    //         fszdq:this.formState.fszdq,
                    //         fxxdz:this.formState.fxxdz,
                    //         fcpmc:this.formState.fcpmc,
                    //         fsqdbh:this.formState.fsqdbh,
                    //         fspdwmc:this.formState.fspdwmc,
                    //         fbldwmc:this.formState.fbldwmc,
                    //         ffsr:this.formState.ffsr,
                    //         ffssj:this.formState.ffssj?moment(this.formState.ffssj).format('YYYY-MM-DD'):'',
                    //         fblr:this.formState.fblr,
                    //     }
                    // }
                    // editServe(data).then(res=>{
                    //     if(res.code == 200){
                    //         this.$message.success('修改成功')
                    //         this.confirmLoading = false
                    //         this.visishow = false
                    //         this.$emit('successReturn',false)
                    //     }else{
                    //         this.$message.warning(res.message)
                    //         this.confirmLoading = false
                    //     }
                    // })
                    // this.handlePreserve(row)
                    canHandle = true
                }else{
                    for(let key in err){
                        this.$message.warning(err[key].errors[0].message)
                        return false
                    }
                    
                }
            });
            return canHandle
        },
        transferClick(){//转办
            var that = this
            if(this.formState.ksfl){
                this.$confirm({
                    title:'您确认要转办吗？',
                    // icon: createVNode(ExclamationCircleOutlined),
                    onOk() {
                        innerChangeFlowJob({jobid:that.formState.jobid,ksfl:that.formState.ksfl}).then(res=>{
                            if(res.code == 200){
                                that.$store.dispatch('UpdateSpinningPrice', 
                                {key:true,stateKey:'modalSpinningPrice'}).then(() => {
                                    that.successReturn(false)
                                    that.$message.success(res.message)
                                })
                                
                            }else{
                                that.$store.dispatch('UpdateSpinningPrice', {key:false,stateKey:'modalSpinningPrice'})
                                that.$message.warning(res.message)
                            }
                        })
                    },
                    
                });
            }else{
                this.$message.warning('请选择转办科室')
            }
            
        },

    }
}
</script>
<style lang="less">
.specialTask-registration-itself{
    // height: calc(100vh - 75px);

    //意见记录
    .opinion-record-box{
        width: 447px;
        display: flex;
        overflow-y: auto;
        border: 1px solid rgb(233 228 228);
        // box-shadow: -1px 25px 20px rgb(233 228 228);
        .content-box{
            width: 100%;
            height: 320px;
            .content-for{
                border-bottom: 1px solid rgb(233 228 228);
                display: flex;
                flex: 1;
                width: 100%;
                .content-item{
                    width: 100%;
                    padding: 10px 20px;
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    .content-text{
                        
                    }
                }
            }
        }
        .no-data-box{
            width: 100%;
            display: flex;
            padding-right: 20px;
            text-align: center;
            justify-content: center;
            height: 100px;
            line-height: 80px;
        }
        
    }
    .material-box{
        margin-left: 180px;
        .ant-form-item-control-wrapper{
            width: 800px !important;
        }
    }
    .vxe-table-box-w{
        .ant-form-item-control-wrapper{
            width: 65px !important;
        }
    }
    .enter-btn{
        .ant-form-item-control-wrapper{
            width: 300px !important;
        }
    }
    .acceptance-no-box{
        
        .ant-form-item-children{
            display: flex !important;
        }
    }

    .vxe-box{
        .commp-vxe-table-box{
            width: 800px !important;
        }
    }
    
    .idea-modal-box{
        .ant-modal-content{
            width: 700px !important;
        }
        .ant-modal-body{
            min-height: 500px !important;
        }
        .pull-input-w{
            width: 100%;
            .ant-form-item-control-wrapper{
                width: 85% !important;
            }
        }
    }
    .file-enter-box{
        .ant-upload-list{
            display: none;
        }
    }
    .red-btn{
        border: 1px solid #ed5565 !important;
        background-color: #ed5565 !important;
    }
    .comments-or-reasons-box{
        .ant-form-item-control-wrapper{
            width: 380px !important;
        }
    }
    // .ant-collapse{
    //     background-color: #ded1de !important;
    //     border:1px solid #ded1de !important;
    //     border-bottom: 0 !important;
    // }
    .specialTask-application-info{
        margin-top: 10px;
        height: calc(100vh - 122px);
        margin-top: 5px;
        overflow: auto;
        background-color: #fff;
        margin-top: -5px;
        padding: 10px;
        border: 1px solid #38f;
        // border-top: none;
        
        .ant-anchor-ink:before{
            display: none !important;
        }
        .ant-anchor-link{
            padding: 11px 0px 11px 16px;
        }
        .related-materials-content-box{
            .clmc-text-btn-v{
                background-color: #dee5ed;
                padding: 5px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                .text-title{
                    font-family: 仿宋_GB2312 !important;
                    font-weight: 600 !important;
                    color: #000;
                }
            }
            .wjList-file-box{
                margin: 8px 10px 0px 10px;
                .wjList-item{
                    display: inline-block;
                    color: #333;
                    margin-bottom: 8px;
                    border: 2px solid #d9d9d9;
                    padding: 3px 5px;
                    border-radius: 8px;
                }
                .toolbox-download-icon-type{
                    color: #229dfc;
                }
                .select-file-box{
                    border-color: #ff9200;
                    background-color: #e6f7ff;
                }
            }
        }
    }
    .isTabs-no-box{
        border: 1px solid #38f;
    }
    .dealwith-tabs{
        background: #fff;
        font-size: 16px !important;
        font-weight: 600;
        .ant-tabs-tab-active,.ant-tabs-tab{
            font-size: 16px !important;
            font-weight: 600 !important;
        }
        .ant-tabs-bar{
            margin: 0 !important;
            
        }
        .ant-tabs-tab{
            padding-top: 8px !important;
            padding-bottom: 8px !important;
            margin-right: 10px !important;
            line-height: 20px !important;
            border-bottom: 1px solid #e8e8e8 !important;
            border-radius: 10px 10px 0 0 !important;
        }
        .ant-tabs-tab-active{
            background-color: #5ca3e5 !important;
            border-color: #5ca3e5 !important;
            color: #fff !important;
            // box-shadow: 0px 0px 12px 0px #5ca3e5;
        }
    }
    // .dealwith-box-a-tabs{
    //     .ant-tabs.ant-tabs-card > .ant-tabs-bar .ant-tabs-tab-active{
    //         border-color: #5ca3e5 !important;
    //     }
    // }
    .file-td-box{
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-content: space-between;
        width: 104px;
        height: 104px;
        overflow: hidden;
        border-radius: 2px;
        border: 1px solid #d9d9d9;
        padding: 8px;
        margin: 8px;
        position: relative;
        .delete-icon-v{
            font-size: 16px;
            position: absolute;
            color: rgb(24, 144, 255);
            right: 11px;
            top: 3px;
        }
        .eye-icon-v{
            font-size: 16px;
            position: absolute;
            color: rgb(24, 144, 255);
            right: 11px;
            top: 38px;
        }
        .download-icon-v{
            width: 20px;
            font-size: 16px;
            position: absolute;
            color: rgb(24, 144, 255);
            right: 9px;
            top: 20px;
        }
        .download-icon-apply{
            top: 10px;
        }
        .fjbz-text-v{
            color: #ff8000;
            font-size: 12px !important;
            display: inline-block;
            width: 28px;
            position: absolute;
            top: 5px;
            left: 3px;
        }
        .file-icon-v{
            font-size: 42px;
            color: rgb(24, 144, 255);
        }
        .file-icon-v{
            font-size: 42px;
            color: rgb(24, 144, 255);
        }
        span{
            height: 40px;
            display:block;
            text-overflow: -o-ellipsis-lastline;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            font-size: 14px;
        }
    }
    .file-td-box1{
        display: inline-block;
        .file-td-item{
            color: #38f;
            display: inline-block;
            border: 1px solid #d9d9d9;
            padding: 5px;
            border-radius: 15px;
            margin: 5px;
        }
        .select-item{
            border: 2px solid #ff9200;
            background-image: linear-gradient(to bottom, #e7f3ff, #fff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff);
            background-size: 100% 100% !important;
        }
    }
    .manufacturing-dealwith-itself{
        textarea.ant-input{
            margin-bottom: 0 !important;
        }
        .ant-form-item{
            margin-bottom: 5px;
        }
        .ant-form-item-label{
            width: 140px !important;
            white-space: inherit !important;
        }
        .ant-form-item-control-wrapper{
            width: 200px !important;
        }
        .ant-form-item-label,.ant-form-item-control-wrapper {
            display: inline-block;
            vertical-align: middle !important;
        }
        .ant-form-item-control-wrapper{
            font-family: 仿宋_GB2312;
        }
        .ant-form-item-control{
            width: 208px;
            line-height: 32px !important;
        }
        .ant-form-item-label {
            display: inline-block;
            vertical-align: middle;
            margin-right: 5px;
            background-color: #e6f7ff;
            min-height: 32px;
            line-height: 1;
            font-weight: 600;
            font-family: simHei;
        }
        .ant-form-item-label label{
            display: flex;
            justify-content: flex-end;
            align-items: center;
            min-height: 32px;
            padding: 5px 3px;
        }
        .textarea-input-l{
            width: 100%;
            display: flex;
            .ant-form-item-control-wrapper{
                flex: 1;
            }
            .ant-form-item-control{
                width: 100%;
            }
        }
        .ant-form-item > .ant-form-item-label,.ant-form-item > .ant-form-item-control-wrapper{
            vertical-align: middle !important;
        }
    } 
    .pull-input-w{
        .ant-form-item-control-wrapper,.vxe-input{
            width: 570px !important;
            margin-right: 0px;
            .vxe-input--inner[disabled]{
                background: #f5f5f5;
            }
        }
        .ant-form-item-control{
            width: 100%;
            line-height: 25px !important;
        }
    }
}
.specialTask-w{
    .specialTask-application-info{
        margin: 0px 0px 0px !important;
        height: calc(100vh - 120px) !important;
        overflow-y: auto;
        border: 1px solid #38f;
    }
    .xzrw-box{
        border-top: 1px solid #38f !important;
        height: calc(100vh - 119px) !important;
    }
    .ant-tabs{
        overflow: initial !important;
    }
    .handle-frame-color{
        // box-shadow: 0px 0px 5px 1px #5ca3e5 !important;
        // box-shadow: 0px 0px 12px -3px #69a3d9 !important;
        height: calc(100vh - 157px) !important;
        border: 1px solid #38f;
        border-top: none;
    }
}

</style>